<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>三个数的最大乘积</title>
</head>

<body>
  <script>
    function max(nums) {
      var len = nums.length;
      nums.sort((a, b) => a - b);

      return nums[len - 1] * nums[len - 2] * nums[len - 3]
    };
    console.log(max([2, 3, 4, 6, 9]));
  </script>
</body>

</html>